package com.ftg.learn.day10.exam;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 图书
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/8/9 下午2:12
 */
@Data
@AllArgsConstructor
public class Book {

    private String name;

    //...

    private volatile int count;


    public synchronized void incrCount() {
        this.count++;
    }

    public synchronized void deIncrCount() {
        this.count--;
    }

}
